<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
</head>
<body>
<div id="app">
  <button @click="isLogin=true">登录</button>
  <button @click="isLogin=false">注册</button>
  <template v-if="isLogin">
    <h2>登录</h2>
    <input type="text" placeholder="请输入用户名" key="login">
    <input type="text" placeholder="请输入密码" key="login1">
  </template>
  <template v-else>
    <h2>注册</h2>
    <input type="text" placeholder="请输入用户名" name="1" key="register">
    <input type="text" placeholder="请输入密码" name="2" key="register1">
  </template>
</div>
<script>
    Vue.config.productionTip = false
    const vm = new Vue({
        el: '#app',
        data() {
            return {
              isLogin:true
            }
        }
    })
</script>
</body>
</html>